<template>
  <div>
    <h1>管理员登录页面</h1>
    <form @submit.prevent="submitForm">
      <label for="username">账号:</label><br>
      <input v-model="username" type="text" id="username" name="username" required><br>
      <label for="password">密码:</label><br>
      <input v-model="password" type="password" id="password" name="password" required><br>
      <input type="submit" value="登录">
    </form>
  <br>
      <button @click="switchLLogin">切换到用户登录页面</button>
  </div>
</template>

<script>
//import axios from 'axios';

export default {
  name: 'managerLogin',
  data() {
    return {
      username: '',
      password: ''
    };
  },
  methods: {
    submitForm() {
      this.$router.push({ name: 'managerPage' });//测试用，之后删除
      // axios.post('http://localhost:8889/api/user/login', {
      //   username: this.username,
      //   password: this.password
      // })
      // .then(response => {
      //   if (response.status === 200) {
      //     this.$router.push({ name: 'managerPage' });
      //   } else {
      //     alert('账号密码错误，登录失败');
      //   }
      // })
      // .catch(error => {
      //   console.error(error);
      // });
    },
    switchLLogin(){
      this.$router.push('/')
    }
  }
}
</script>
